home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Entertainment / Color Games / Arcade / Desk Invaders / Read Me < prev   
Text File  |  1991-09-14  |  7KB  |  137 lines

  1. Enclosure: Desk Invaders 2.0.PKG
  2.  
  3.  
  4. Desk Invaders is a version of the classic arcade game “Space Invaders”,
  5. implemented as a DA! You can shoot away at those little critters whenever the
  6. stress and strain of using your Mac gets too much, whatever application you may
  7. be running.
  8.  
  9. Desk Invaders is free, and you may give it away to your friends and colleagues
  10. as you please, as long as the game is copied unmodified, and this document
  11. accompanies it.
  12.  
  13. I wrote Desk Invaders as an exercise in Mac programming, and to be a cute piece
  14. of software. I hope I succeeded. If you enjoy it, I would appreciate a postcard
  15. or note from your home town.
  16.  
  17. Now the bad news. Desk Invaders can’t be run on anything other than a Macintosh
  18. II family member (or an LC) with 256 colours or gray levels set for it’s main
  19. monitor. Sorry to be elitist, Mac Plus and SE users, but let’s face it, a black
  20. and white shoot-em-up? A trifle dull. However I might do a b&w version if there
  21. is a demand. The 8 bit caveat is due to the fact that the pixel images used in
  22. the game are 8 bit, and copying to a screen of another depth reduces game speed
  23. to glacial proportions, as well as ruining the dithered shading effects.
  24.  
  25. Talking of game speed, because this is a DA, it relies on co-operation from the
  26. host application to call it often enough to keep everything moving smoothly.
  27. Normally, this is OK, but some applications are a bit naughty in this respect,
  28. like MacWrite II under MultiFinder, and most notably Hypercard. What is
  29. Hypercard doing all the time? It’s a mystery.
  30.  
  31. One other word of warning. Because this DA needs a little more RAM than most,
  32. if you are running under MultiFinder, I don’t advise opening the DA in the
  33. application layer (by holding down the option key when the DA is chosen),
  34. especially in the Finder’s layer. Although I try to recover gracefully from low
  35. memory, this is not foolproof. Let DA Handler handle the DA under MultiFinder.
  36. That is it’s job, after all.
  37.  
  38. The DA is (I hope) fully self explanatory. Use the Desk Invaders menu to show
  39. Help and “About” messages. The “Bunkers” option selects whether defensive
  40. bunkers are enabled or not.
  41.  
  42. Bonuses are awarded for shooting the Motherships. The faster they go, the more
  43. points you get if you hit one. You also get a 50 point per second bonus for
  44. completing a level inside 45 seconds.
  45.  
  46. Motherships occaisionally drop Smart Bombs. These home in on your position, but
  47. can be shot down or dodged. If one hits a bunker, the bunker is destroyed
  48. completely.
  49.  
  50. As you go up the levels, the Invaders get tougher and more determined to kill
  51. you.
  52.  
  53. Have Fun!
  54.  
  55.  
  56. This program is dedicated to the Apple programmer who wrote the CopyBits
  57. toolbox call, without which this program would just sit there doing nothing.
  58. Was it Bill Atkinson?
  59.  
  60. Techie Stuff.
  61.  
  62. I am often intrigued (being a techie programmer type) how programmers achieve
  63. certain effects in games, etc. But, they never volunteer the information. So
  64. here is a brief description of how this program does what it does, for those of
  65. you who give a damn.
  66.  
  67. DA’s receive events prefiltered by the application sitting underneath them, and
  68. therefore event handling is actually easier in a DA than in an application. One
  69. type of event a DA receives is call ‘AccCursor’ which is called once each time
  70. round the host application’s main loop, as long as the DA window is in front.
  71. In Desk Invaders, this call is used to perform almost all of the game action. A
  72. DA can also request calls on a periodic basis, and Desk Invaders uses a 1
  73. second ‘AccRun’ event to handle the bonus timer. Other events, such as
  74. MouseDown and Key events, are used to fire off your bullet.
  75.  
  76. To keep everything moving smoothly, with no nasty jerks in the action when
  77. different things happen, each entity on screen has a timer associated with it,
  78. which controls it’s rate. For example, the routine to move the invaders is
  79. called every AccCursor call, but if it’s own timer has not reached the
  80. appointed time (as determined by TickCount), the routine returns without
  81. performing any movement, and the program calls the next routine, to move the
  82. base or bullets, for example. This method means that action continues at the
  83. same rate regardless of what the CPU clock speed is.
  84.  
  85. Desk Invaders is unusual for a Mac arcade game in that it relies totally on
  86. QuickDraw, and does not access the video RAM directly. This approach is
  87. inherently slower, so certain measures have to be taken to pre-arrange the
  88. graphics to keep the speed reasonable. The graphics for Desk Invaders are held
  89. in it’s resource fork as PICT resources, which makes them easy to edit. But
  90. drawing pictures is slow, so Desk Invaders creates a set of offscreen GrafPorts
  91. when it is opened, into which the PICT’s are drawn. The pictures are then
  92. released, and take no further part in the action. The call CopyBits (or it’s
  93. close cousin, CopyMask) is used to transfer blocks of pixels from the offscreen
  94. ports to the DA window. CopyBits is fast, as long as the source and destination
  95. ports have the same pixel depth, and use the same set of colours. (Desk
  96. Invaders uses the standard system palette everywhere.) This explains the
  97. problem of non-8-bit screens.
  98.  
  99. Each graphic element is drawn in two stages; first the old position is used to
  100. replot the background, then the new position is used to plot the element.
  101. Various tricks and manipulations are done to eliminate flicker, usually
  102. involving the use of a mask for the element, also created from a PICT using the
  103. offscreen method. Negative masks are sometimes used when filling in background,
  104. and this is generated from the positive mask in a seperate offscreen port by
  105. inverting. Sometimes, regions are used as a mask, as in the case of the bunkers
  106. and the invaders themselves.
  107.  
  108. Offscreen ports require a fair amount of RAM for their images. Desk Invaders
  109. requires a total of about 150K of heap space in operation.
  110.  
  111. Text is drawn using DrawString or TextBox. Some graphics, which are not time
  112. critical, are drawn directly from the PICT resource using DrawPicture. All in
  113. all, this should run on most Macs without difficulty, as it follows the rules
  114. all the way!
  115.  
  116. Desk Invaders is critically dependant on it’s resources. In particular, the
  117. graphic elements PICTs and the ‘nrct’ resource which defines the element areas
  118. for plotting, should never be edited. You have been warned, adventurous types!
  119.  
  120.  
  121.  
  122. Desk Invaders was written in THINK C version 4.0, and as such contains portions
  123. of code copyright Symantec corp. It took about 4 days to write, 4 days I should
  124. have spent doing something much more constructive (although probably less
  125. creative).
  126. If you feel like dropping me a line, write to :
  127.  
  128. Graham Cox
  129. 10, Carpenters Cottages
  130. Clearwell
  131. Coleford
  132. Gloucestershire
  133. GL16 8JX
  134. ENGLAND.
  135.  
  136. ©1991 Graham Cox. All rights reserved.
  137.